////获取系统当前时间
//#include <stdio.h>
//#include <time.h>
//#include <stdlib.h>
//#include <windows.h>
//typedef signed char        int8_t;
//typedef short              int16_t;
//typedef int                int32_t;
//typedef long long          int64_t;
//typedef unsigned char      uint8_t;
//typedef unsigned short     uint16_t;
//typedef unsigned int       uint32_t;
//typedef unsigned long long uint64_t;
//void system_curTime(struct tm *timtinfo) {
//	time_t rawtime;
//	time(&rawtime);//get current time
//	timtinfo = localtime(&rawtime);
//	printf("current time is:%s\n", asctime(timtinfo));
//	printf("%04x%02x%02d%02x%02x%02x \n", 1900 + timtinfo->tm_year, 1 + timtinfo->tm_mon,
//	       timtinfo->tm_mday, timtinfo->tm_hour, timtinfo->tm_min, timtinfo->tm_sec);
//}
//int time_bcd2array(uint8_t* bcdTime) {
//	time_t rawtime;
//	time(&rawtime);
//	struct tm* timeinfo;
//	timeinfo = localtime(&rawtime);
//	sprintf(bcdTime, "%04X%02X%02X%02X%02X%02X",
//	        1900 + timeinfo->tm_year,
//	        1 + timeinfo->tm_mon,
//	        timeinfo->tm_mday,
//	        timeinfo->tm_hour,
//	        timeinfo->tm_min,
//	        timeinfo->tm_sec);
//	return bcdTime;
//}
//int main() {
//	//struct tm time1, time2;
//	int t1, t2, t3, t4;
//	t3 = time_bcd2array(&t1);
//	printf("t3 = %x\n", t3);
//	Sleep(3000);
//	t4 = time_bcd2array(&t2);
//	printf("t4 = %x\n", t4);
//	printf("t4 - t3 = %x", (t4 - t3));
////	int time = (int)timtinfo;
////  printf("time = %d\n", time);
//	return 0;
//}
#include <time.h>
#include <stdio.h>

int main(void) {
	time_t timep;
	struct tm *p;
	int in_time[3];
	int now_time[7];
	int i;

	time (&timep);
	p = gmtime(&timep);

	now_time[0] = 1900 + p->tm_year;
	printf("now time: %x\n", now_time[0]);
	now_time[1] = 1 + p->tm_mon;
	now_time[2] = p->tm_mday;
	now_time[3] = p->tm_min;
	now_time[4] = p->tm_sec;
	printf("now time sec is: %x\n", now_time[4]);

	printf("输入年-月-日: ");
	scanf("%d-%d-%d", &in_time[0], &in_time[1], &in_time[2]);

	for (i = 0; i < 3; i++)
		if (in_time[i] > now_time[i]) {
			printf("你输入的日期大\n");
			break;
		} else if (in_time[i] < now_time[i]) {
			printf("你输入的日期小\n");
			break;
		} else
			continue;
	if (i == 3)
		printf("两个日期一样大\n");

//  printf("%d\n",p->tm_sec); /*获取当前秒*/
//  printf("%d\n",p->tm_min); /*获取当前分*/
//  printf("%d\n",8+p->tm_hour);/*获取当前时,这里获取西方的时间,刚好相差八个小时*/
//  printf("%d\n",p->tm_mday);/*获取当前月份日数,范围是1-31*/
//  printf("%d\n",1+p->tm_mon);/*获取当前月份,范围是0-11,所以要加1*/
//  printf("%d\n",1900+p->tm_year);/*获取当前年份,从1900开始，所以要加1900*/
//  printf("%d\n",p->tm_yday); /*从今年1月1日算起至今的天数，范围为0-365*/

}
